package com.moli.iov.down.enums.command;

/**
 * <p>
 *  响应协议指令枚举
 * </p>
 *
 * @author: zql
 * @Date: 2018/12/11 14:58
 */
public enum ResposeCommandEnum {

    /**
     * 远程车辆控制命令响应
     */
    REMOTE_CONTROL_RES((byte) 0xD2, "远程车辆控制命令响应"),

    /**
     * 远程升级命令响应
     */
    REMOTE_UPGRADE_RES((byte)0xD4, "远程升级命令响应"),

    /**
     * 终端参数查询命令响应
     */
    TERMINAL_PARAMETER_QUERY_RES((byte)0xD8, "终端参数查询命令响应"),

    /**
     * 终端参数设置响应
     */
    TERMINAL_PARAMETER_SETTING_RES((byte)0xD9, "终端参数设置响应"),

    /**
     * 终端控制响应
     */
    TERMINAL_CONTROL_RES((byte)0xDD, "终端控制响应");

    private byte flag;

    private String msg;


    ResposeCommandEnum(byte flag, String msg){
        this.flag = flag;
        this.msg = msg;
    }

    /**
     * 返回发送命令
     * @return
     */
    public static Byte getCommandEnum(byte value){
        switch (value){
            case (byte)0xD2:
                return CommandEnum.REMOTE_CONTROL.getFlag();
            case (byte)0xD4:
                return CommandEnum.REMOTE_UPGRADE.getFlag();
            case (byte)0xD8:
                return CommandEnum.TERMINAL_PARAMETER_QUERY.getFlag();
            case (byte)0xD9:
                return CommandEnum.TERMINAL_PARAMETER_SETTING.getFlag();
            case (byte)0xDD:
                return CommandEnum.TERMINAL_CONTROL.getFlag();
                default:
                    return null;
        }
    }

    public byte getFlag() {
        return flag;
    }

    public String getMsg() {
        return msg;
    }}
